import Ember from 'ember';
import {
  modelNameFromRouteName
}
from 'emberworkspace/utils/app-util';

export default Ember.Mixin.create({
  minxedModel(params) {
      var store = this.store,
        modelName = modelNameFromRouteName(this.get('routeName')),
        projection = this.get('projection');

      params = params || {};
      if (projection) {
        params.projection = projection;
      }
      if (!params.q) {
        delete params.q;
      }
      return store.query(modelName, params);

    },
    model(params) {
      return this.minxedModel(params);
    }
});
